﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FazaDemo.QL.AbstractQueryModel;
using FazaDemo.ViewModels;
using FazaDemo.Data;

namespace FazaDemo.QueryModel
{
    public class DistrictViewRepository : IQueryRepository<object, DistrictViewModel>
    {
        public IList<DistrictViewModel> Get()
        {
            using (var context = new FazaEntities1())
            {
                var districts = context.Set<TS_RAYON>().ToList();
                return districts.Select(d => new DistrictViewModel
                {
                    Id = d.ID, 
                    Name = d.NM
                }
                ).ToList();
            }
        }

        public DistrictViewModel Get(object context)
        {
            return default(DistrictViewModel);
        }
    }
}
